<!DOCTYPE html>
<html lang="en">

<head>
    <#include "/lx/admin/components/meta.html" />
    <title>证书管理${metaTitleSuffix!}</title>
    <#include "/lx/admin/components/stylesheets.html" />
</head>

<body>
    <div id="app">
        <el-container>
            <#assign menuIndex="5-1" />
            <#include "/lx/admin/components/menu.html" />
            <el-container>
                <#include "/lx/admin/components/header.html" />
                <el-main>
                    <template>
                        <el-row>
                            <el-col :span="12">
                                <div class="title theme-color1">证书列表</div>
                            </el-col>
                            <el-col :span="12">
                                <div class="operations">
                                    <el-button type="success" size="small" @click="add"><i class="el-icon-plus"></i>添加证书</el-button>
                                </div>
                            </el-col>
                        </el-row>
                        <el-table ref="multipleTable" :data="list" tooltip-effect="dark" :stripe='true' style="width: 100%">
                            <el-table-column prop="title" label="证书名称">
                            </el-table-column>
                            <el-table-column prop="schoolName" label="大学">
                            </el-table-column>
                            <el-table-column prop="startTime" label="开始时间" width="180">
                            </el-table-column>
                            <el-table-column prop="endTime" label="结束时间" width="180">
                            </el-table-column>
                            <el-table-column prop="sort" label="排序" width="70">
                            </el-table-column>
                            <el-table-column prop="status" label="状态" width="60">
                                <template slot-scope="scope">
                                    <span v-if="scope.row.status == 0">禁用</span>
                                    <span v-if="scope.row.status == 1">正常</span>
                                </template>
                            </el-table-column>
                            <el-table-column fixed="right" label="操作" width="160">
                                <template slot-scope="scope">
                                    <el-button @click="toCourseList(scope.row)" type="text" size="small">课程</el-button>
                                    <el-button @click="edit(scope.row)" type="text" size="small">编辑</el-button>
                                    <el-button @click="del(scope.row)" type="text" size="small" style="color: red;">删除</el-button>
                                </template>
                            </el-table-column>
                        </el-table>
                        <#include "/lx/admin/components/page.html" />
                    </template>
                </el-main>
            </el-container>
        </el-container>
        <#include "/lx/admin/components/footer.html" />
    </div>
    <#include "/lx/admin/components/scripts.html" />
    <script>
        var vue = new Vue({
        el: '#app',
        data() {
            return {
                list: []
            }
        },
        mounted: function() {
        },
        methods: {
            add() {
                window.location.href = "/lx/admin/cert/info";
            },
            toCourseList(item){
                window.location.href = "/lx/admin/cert/courseList?certificateId=" + item.id;
            },
            edit(item) {
                window.location.href = "/lx/admin/cert/info?certificateId=" + item.id;
            },
            del(item) {
                var self = this;
                confirm("确认删除？请谨慎操作", "确认", function() {
                    var url = "/lx/admin/cert/delete"
                    var param = {
                        certificateId: item.id
                    };
                    var success = () => {
                        window.location.href = "/lx/admin/cert/list";
                    }
                    var fail = (response) => {
                        msg(response.data.msg);
                    }
                    var complete = () => {}
                    axiosRequestPro(url, param, success, fail, complete);
                })
            },
            onPageChange(val) {
                // console.log('当前页: {val}' + val);
                goPage(val)
            }
        }
    })
    </script>
    <script>
        vue.list = ${items!}
    </script>
    <#include "/lx/admin/components/msg.html" />
    <style type="text/css">
    .title {
        font-size: 18px;
        font-weight: bold;
    }

    .operations {
        text-align: right;
    }
    </style>
</body>

</html>